{extend name="layout/layout" /}

{block name="pagecss"}

{/block}

{block name="content"}
<div class="row">
	<div class="col-md-12">
		<!-- BEGIN SAMPLE FORM PORTLET-->
		<div class="portlet light">
			<div class="portlet-title">
				<div class="caption">
					<i class="icon-share font-dark"></i>
					<span class="caption-subject font-dark bold uppercase"> {$title}</span>
				</div>
				<div class="actions">
					<a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
				</div>
			</div>
			<div class="portlet-body">
				<!--<h4>Horizontal Form</h4>-->
				<form id="ajax-form" action="{:url('agent/agent/editpost')}" class="form-horizontal" name="ajaxForm">
					<div class="form-group">
						<label for="name" class="col-md-2 control-label">代理商名称</label>
						<div class="col-md-8">
							<input type="text" class="form-control" id="name" name="name" value="{$info.name}" placeholder="">
						</div>
					</div>
					<div class="form-group">
						<label for="levelId" class="col-md-2 control-label">代理级别</label>
						<div class="col-md-8">
							<select class="form-control" id="levelId" name="levelId">
								{foreach name="agentLevel" item="level" key="levelKey"}
								<option value="{$level.id}" {if condition="($info['levelId'] == $level['id'])"}selected="selected"{/if}>{$level.levelName}</option>
								{/foreach}
							</select>
							<input type="hidden" name="levelName" value="{$info.levelName}">
						</div>
					</div>
					<div class="form-group">
						<label for="parentId" class="col-md-2 control-label">所属上级</label>
						<div class="col-md-8">
							<input type="button" class="btn green-sharp btn-outline btn-block sbold uppercase" id="parentId" value="{$info.parentName ?: '请选择'}" data-toggle="modal" data-target="#parentId-modal">
							<input type="hidden" class="form-control" name="parentId" value="{$info.parentId}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">所在地区</label>
						<div class="col-md-8">
							<div class="row">
								<!--<div class="col-md-4">
									<select id="province" name="province" class="form-control areaLists"></select>
								</div>
								<div class="col-md-4">
									<select id="city" name="city" class="form-control areaLists" ></select>
								</div>
								<div class="col-md-4" style="display: none;">
									<select id="district" name="district" class="form-control areaLists"></select>
								</div>
								<input type="hidden" class="province" value="{$info.province}">
								<input type="hidden" class="city" value="{$info.city}">
								<input type="hidden" class="district" value="{$info.district}">-->
								<div class="col-md-4">
									<select id="province" name="province_id" class="form-control"></select>
								</div>
								<div class="col-md-4">
									<select id="city" name="city_id" class="form-control"></select>
								</div>
								<div class="col-md-4" style="display: none;">
									<select id="district" name="district_id" class="form-control"></select>
								</div>
								<input type="hidden" class="form-control province" name="province" value="{$info.province}">
								<input type="hidden" class="form-control city" name="city" value="{$info.city}">
								<input type="hidden" class="form-control district" name="district" value="{$info.district}">
							</div>
						</div>
					</div>
					<!--<div class="form-group">
						<label for="rechargeAmount" class="col-md-2 control-label">充值金额</label>
						<div class="col-md-8">
							<input type="text" class="form-control" id="rechargeAmount" name="rechargeAmount" value="{$info.rechargeAmount ? $info.rechargeAmount / 100 : ''}" placeholder="">
						</div>
					</div>-->
					<div class="form-group">
						<label for="loginName" class="col-md-2 control-label">代理商账号</label>
						<div class="col-md-8">
							<input type="text" class="form-control" id="loginName" name="loginName" value="{$info.loginName}" placeholder="">
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-md-2 control-label">密码</label>
						<div class="col-md-8">
							<input type="password" class="form-control" id="password" name="password" value="" placeholder="">
						</div>
					</div>
					<div class="form-group">
						<label for="confirm_password" class="col-md-2 control-label">确认密码</label>
						<div class="col-md-8">
							<input type="password" class="form-control" id="confirm_password" name="confirm_password" value="" placeholder="">
						</div>
					</div>
					<div class="form-group">
						<label for="contactUser" class="col-md-2 control-label">联系人</label>
						<div class="col-md-8">
							<input type="text" class="form-control" id="contactUser" name="contactUser" value="{$info.contactUser}" placeholder="">
						</div>
					</div>
					<div class="form-group">
						<label for="phone" class="col-md-2 control-label">手机号</label>
						<div class="col-md-8">
							<input type="text" class="form-control" id="phone" name="phone" value="{$info.phone}" placeholder="">
						</div>
					</div>

					<input type="hidden" class="form-control" name="id" value="{$info.id}">
					<input type="hidden" class="form-control" name="userId" value="{$info.userId}">
					<input type="hidden" class="form-control" name="ori_password" value="{$info.password}">

					<hr>
					<div class="row">
						<div class="form-actions">
							<div class="col-md-offset-2 col-md-10">
								<button type="button" class="btn blue save-btn">
									保存 <i class="fa fa-floppy-o"></i>
								</button>
								<button type="button" class="btn default" onclick="history.go(-1);">
									返回 <i class="fa fa-mail-forward"></i>
								</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<!-- END SAMPLE FORM PORTLET-->
	</div>
</div>

<!-- 所属上级 模态框 -->
<div class="modal fade" id="parentId-modal" data-backdrop="static" data-keyboard="false" >
	<div class="modal-dialog" style="width:800px; height: 520px;">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">x</button>
				<h4 class="modal-title">所属上级</h4>
			</div>
			<div class="modal-body">
				<div class="row" id="search">
					<div class="col-md-3">
						<input type="text" class="form-control" name="name" placeholder="代理商名称">
					</div>
					<div class="col-md-3">
						<button type="button" class="btn green" id="doSearch">
							<i class="fa fa-search"></i> 搜索
						</button>
					</div>
				</div>
				<table class="table" id="parentId_table">
					<thead>
					<tr>
						<th>代理商名称</th>
						<th>代理商级别</th>
						<th>所在区域</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-info" data-dismiss="modal">确定</button>
				<button type="button" class="btn default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>

<input type="hidden" class="redirect_url" value="{:url('agent/agent/index')}">
<input type="hidden" class="parentIdList_url" value="{:url('agent/agent/parentIdList')}">
<input type="hidden" class="getregion_url" value="{:url('agent/region/getregion')}">
{/block}

{block name="pagescript"}
<!--<script src="__STATIC__/admin/pages/js/Area.js" type="text/javascript"></script>-->
<script src="__STATIC__/admin/pages/js/get_address.js" type="text/javascript"></script>
<script src="__STATIC__/agent/pages/js/agent.js" type="text/javascript"></script>
{/block}